﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web
{
    public partial class WebUserCallMsg : FromentWebCommon
    {
        public Model.view_call_msg model = new Model.view_call_msg();

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["Id"] != null)
                {
                    if (Request.QueryString["Id"].Trim().Length > 0)
                    {
                        GetModel(Convert.ToInt32(Request.QueryString["Id"]));
                    }
                }

            }
        }
        public void GetModel(int Id)
        {
            Model.tb_order data = Common.SqlExption.GetList<Model.tb_order>().FirstOrDefault(c => c.Id.Equals(Id));
            if (string.IsNullOrEmpty(Common.UICookie.ReadCookie("ClientUId")))
            {
                Response.Write("<script>alert('请先登录！');window.location.href='default.aspx';</script>");
            }
            else
            {
                int cid = Convert.ToInt32(Common.UICookie.ReadCookie("ClientUId"));

                if (data != null)
                {
                    var clientMOdel = Common.SqlExption.GetList<Model.tb_call_msg>().FirstOrDefault(c => c.Id.Equals(Id));

                    model.Id = 0;
                    model.server_id = 0;
                    model.client_id = cid;
                    model.create_time = DateTime.Now;
                    model.order_number = data.order_number;
                    model.call_msg = string.Empty;
                    model.contents = string.Empty;
                    model.cient = Common.SqlExption.GetList<Model.tb_user>().FirstOrDefault(c => c.Id.Equals(cid)).name;

                }




            }
        }
    }
}